﻿using System;
using System.Collections.Generic;
using SeaBattle.Domain.Abstract;
using SeaBattle.Domain.Entities;

namespace SeaBattle.Domain.Concrete
{
    public class FakeGameRepository : IGameRepository
    {
       private readonly List<Game> games = new List<Game>();

       private int GetNextId()
        {
            return games.Count + 1;
        }

        public Game CreateNewGame(Player creator)
        {
            return new Game(GetNextId(), DateTime.Now, creator);
        }

        public bool SaveGame(Game game)
        {
            if (!games.Contains(game))
            {
                games.Add(game);
            }
            return true;
        }
    }
}
